package edu.gd.mvndemo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

@WebServlet("/regist")
public class RegistServlet extends HttpServlet {

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.doGet(req, resp);
        String user=req.getParameter("name");
        String password=req.getParameter("password");
        String sex=req.getParameter("sex");
        String question=req.getParameter("question");
        String answer=req.getParameter("answer");
        String introduce=req.getParameter("desc");
        Insert.insert(user,password,sex,question,answer,introduce);
        resp.sendRedirect(req.getContextPath()+"/login.jsp");
    }
}
